package org.example.salesystem.controller;

import org.example.salesystem.entity.ResultBody;
import org.example.salesystem.service.UserCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/UserComment")
@CrossOrigin(origins="*")
public class UserCommentController {
    @Autowired
    private UserCommentService userCommentService;
    @RequestMapping("/addComment")
    public ResultBody addComment(@RequestBody Map<String,Object> map)
    {
        if(map.get("code")==null||map.get("comment")==null||map.get("point")==null||map.get("phone")==null) {
            return new ResultBody(404, "缺少参数", false);
        }
        return userCommentService.addComment(map);
    }
}
